function rec(x) {
    if (x.length === 0) {
		return ""
    }
    return x[x.length -1] + rec(x.slice(0,x.length-1))
}

rec("hello")